import * as api from "@/api/comment";
export default {
  namespaced: true, //命名空间
  state: {
    comments: [],
  },
  mutations: {
    //修改comments
    SET_COMMENT(state, payload) {
      state.comments = payload;
    },
  },
  actions: {
    async FETCH_COMMENT(context) {
      console.log(context);
      //发起获取评论的请求
      let res = await api.getComment();
      console.log(res);
      context.commit("SET_COMMENT", res.data.data);
    },
  },
};
